package dao;

import domain.Admin;
import mapper.AdminMapper;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

/**
 * Created by jianweilin on 16/8/28.
 */
public class AdminDaoImpl implements AdminDao {
    @Override
    public Admin getAdminById(SqlSession sqlSession, Integer id) {
        AdminMapper mapper = sqlSession.getMapper(AdminMapper.class);
        return mapper.getAdminById(id);
    }

    @Override
    public Integer saveAdmin(SqlSession sqlSession, Admin admin) {
        AdminMapper mapper = sqlSession.getMapper(AdminMapper.class);
        return mapper.saveAdmin(admin);
    }

    @Override
    public List<Admin> getAdminByUserNameOrNickname(SqlSession sqlSession,Admin admin) {
        AdminMapper mapper = sqlSession.getMapper(AdminMapper.class);

        return mapper.getAdminByUserNameOrNickname(admin);
    }

    @Override
    public List<Admin> getAdminByAdmins(SqlSession sqlSession, List<Admin> admins) {
        AdminMapper mapper = sqlSession.getMapper(AdminMapper.class);
        return mapper.getAdminByAdmins(admins);
    }

    @Override
    public List<Admin> getAdminByAnyOneCondition(SqlSession sqlSession, Admin admin) {
        AdminMapper mapper = sqlSession.getMapper(AdminMapper.class);
        return mapper.getAdminByAnyOneCondition(admin);
    }

    @Override
    public Integer updateById(SqlSession sqlSession, Admin admin) {
        AdminMapper mapper = sqlSession.getMapper(AdminMapper.class);
        return mapper.updateById(admin);
    }
}
